clear all
set	more off

cd "~/Dropbox/ors_quality_R01"
use "data/KDG/know_do_gap.dta", clear

	
	*creating new variables for labeling purposes
	
	gen ors_pref = sp_type_cod==1
	gen anti_pref = sp_type_code==2
	gen no_pref = sp_type_code==3
	gen noincentive = sp_type_code==4
	gen supply = treatment
	
	
	label var  ors_pref "ORS Preference vs. Antibiotics Preference"
	label var  no_pref "No Preference vs. Antibiotics Preference"
	label var  anti_pref "Antibiotics Preference"
	label var  noincentive "No Financial Incentive"
	label var  supply "Given ORS supply"	

	gen MBBS = prov_type==1
	gen RMP = prov_type==2
	gen AYUSH = prov_type==3
	gen Pharmacy = prov_type==4
	
*******************************
*** Antibiotics Prescribing ***
*******************************
	
	*MBBS
	sum rec_anti if sp_type==2 & MBBS ==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if MBBS ==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex replace dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("MBBS") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	
	*RMP
	sum rec_anti if sp_type==2 & RMP ==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if RMP ==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("RMP") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	
	*AYUSH
	sum rec_anti if sp_type==2 & AYUSH ==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if AYUSH ==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("AYUSH") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No)
	
	*Pharmacy
	sum rec_anti if sp_type==2 & Pharmacy ==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if Pharmacy ==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("Pharmacy") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	

*******************
*** Know Do Gap ***
*******************
	
	*MBBS
	sum rec_anti if sp_type==2 & MBBS ==1 & know_anti==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if MBBS ==1 & know_anti==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex  dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("MBBS") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	
	*RMP
	sum rec_anti if sp_type==2 & RMP ==1 & know_anti==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if RMP ==1 & know_anti==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("RMP") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
	
	*AYUSH
	sum rec_anti if sp_type==2 & AYUSH ==1 & know_anti==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if AYUSH ==1 & know_anti==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("AYUSH") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No)
	
	*Pharmacy
	sum rec_anti if sp_type==2 & Pharmacy ==1 & know_anti==1
	local cntl_mean = r(mean)
	
	reg rec_anti ors_pref no_pref noincentive supply if Pharmacy ==1 & know_anti==1, cluster(town_code)
	outreg2 using "tables/drivers_anti_type", tex dec(3) ///
	nocons nor2 nonotes label ///
	ctitle("Pharmacy") ///
	keep(ors_pref no_pref) ///
	adds(Mean in antibiotic preference arm, `cntl_mean') /// 
	addtext(Controls, No) 
